API ReferenceΒΆ

The signal_builder module implement the SignalBuilder class used in create to produce an audio sample by additive synthesis. It basically approximates the analytical signal by summing the Fourier series for each component given as input (when triangle, sawtooth, or square is specified as shape parameter), and finally sum together all components. To save the audio on file, call its export(filename) method.


The signal_plotter module implement the SignalPlotter class used in view to: plot the signal itself, its Frequency Spectrum and the Spectrogram.

The class takes as input the audio file path as it is a subclass of the base class Signal, which loads the audio, calculate envelopes and spectra directly in the constructor.

To retrieve the audio information, assuming s is a Signal instance:

  • s.CHANNELS is a dict holding the audio signal as an array accessible via the 'ch1' (and 'ch2' if stereo) keys.
  • s.ENVELOPES is a dict holding the signal envelop calculated via the hilbert method in scipy.signal accessible via the 'ch1_envelope' (and 'ch2_envelope' if stereo) keys.
  • s.SPECTRA is a dict holding the spectral information accessible via the 'ch1_fft' (and 'ch2_fft' if stereo) keys, which in turn returns another dict with the 'freqs' and 'pws' (respectively defined as class constants s.FREQUENCIES and s.POWERS) keys. So to get the power spectrum information for the first channel: s.SPECTRA['ch1_fft'][s.POWERS] and s.SPECTRA['ch1_fft'][s.FREQUENCIES].